package com.mdh.influxdb.config;

import com.influxdb.client.InfluxDBClient;
import com.influxdb.client.InfluxDBClientFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class InfluxDBConfig {


    @Value("${spring.influx.url}")
    private String url;

    @Value("${spring.influx.token}")
    private String token;


    @Bean
    public InfluxDBClient buildInfluxDBClient() {
        // 生成客户端
        return InfluxDBClientFactory.create(url, this.token.toCharArray());
    }

}
